package com.design.cjm.structural.decorator.example1;

/**
 * 测试装饰者模式
 *
 * @Author: Jie Ming Chen
 * @Date: 2018/9/19
 * @Version 1.0
 */
public class TestApp {

    /**
     * 首先用ConcreteComponent实例化对象c, 然后用ConcreteDecoratorA的实例化对象a
     * 来包装c,再用ConcreteDecoratorB的对象d 包装a,最后执行b的operation()
     *
     * @param args
     */
    public static void main(String[] args) {
        ConcreteComponent c = new ConcreteComponent();
        ConcreteDecoratorA a = new ConcreteDecoratorA();
        ConcreteDecoratorB b = new ConcreteDecoratorB();

        a.setComponent(c);
        b.setComponent(a);
        b.operation();
    }
}
